﻿using System;

class PrimeFactors
{
    public static void Main(string[] args)
    {
        Console.WriteLine("请输入一个整数:");
        int num = int.Parse(Console.ReadLine());
        Console.WriteLine("素数因子如下：");
        FindPrimeFactors(num);
        Console.Read();
    }

    public static void FindPrimeFactors(int num)
    {
        for (int i = 2; i <= num; i++)
        {
            if (num % i == 0)
            {
                Console.WriteLine(i);
                while (num % i == 0)
                {
                    num /= i;
                }
            }
        }
    }
}

